package com.dtsheep.elasticsearch.es.client.index;

import com.dtsheep.elasticsearch.es.client.ElasticsearchClientUtil;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.client.RequestOptions;

import java.io.IOException;

/**
 * DeleteIndex
 *
 * <p>
 *     删除索引
 * </p>
 *
 * @author chuanbai
 * @date 2024/5/24
 */
public class DeleteIndex {

    public static void main(String[] args) throws IOException {
        AcknowledgedResponse response = ElasticsearchClientUtil.getEsClient()
                .indices()
                .delete(new DeleteIndexRequest("user"), RequestOptions.DEFAULT);
        //结果
        System.out.println(response.isAcknowledged());
    }
}
